<jsp:include page="template-top.jsp" />

<p style="font-size:medium">
    To register, enter the following information. (All fields required.)
</p>

<jsp:include page="error-list.jsp" />

<%@ page import="assignment4.formbeans.LoginForm,assignment4.formbeans.RegisterForm" %>

<p>
	<form method="post" action="register.do">
		<input type="hidden" name="redirect" value="${redirect}"/>
		<input type="hidden" id="email" name="email" value="${form.email}"/>
		<input type="hidden" id="password" name="password" value="${form.password}"/>
		<input type="hidden" id="salt" name="salt" value="${form.salt}">
		<table>
		<%
		if(request.getAttribute("form") instanceof LoginForm){
		%>
			<tr>
				<td>First Name: </td>
				<td><input type="text" id="firstname" name="firstname" value=""/></td>
			</tr>
			<tr>
				<td>Last Name: </td>
				<td><input type="text" id="lastname" name="lastname" value=""/></td>
			</tr>
		
		<%}else{%>
			<tr>
				<td>First Name: </td>
				<td><input type="text" id="firstname" name="firstname" value="${form.firstname}"/></td>
			</tr>
			<tr>
				<td>Last Name: </td>
				<td><input type="text" id="lastname" name="lastname" value="${form.lastname}"/></td>
			</tr>
		<%}%>
			<tr>
				<td>Confirm Password: </td>
				<td><input type="password" id="confirmpassword" name="confirmpassword" value=""/></td>
			</tr>
			<tr>
				<td colspan="2" align="center">
					<input type="submit" id="completeregistration" name="completeregistration" value="Register"/>
				</td>
			</tr>
		</table>
	</form>
</p>

<jsp:include page="template-bottom.jsp" />

